package com.example.gestureactivity2;

import java.util.ArrayList;

import com.example.gestureactivity2.view.GestureView;

import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class AnotherActivity extends BaseActivity {

	private ArrayList<TextView>	list;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_another);

		initView();
	}

	private void initView() {
		GestureView mLayout = (GestureView) findViewById(R.id.layout_another);
		ListView mLvAnother = (ListView) findViewById(R.id.lv_another);

		list = new ArrayList<TextView>();
		for (int i = 0; i < 20; i++) {
			TextView textView = new TextView(this);
			textView.setText("This is item " + (i + 1));
			textView.setTextSize(25);
			list.add(textView);
		}

		MyAdapter adapter = new MyAdapter();
		mLvAnother.setAdapter(adapter);

		mLayout.setOnFlingListener(this);
	}

	private class MyAdapter extends BaseAdapter {

		@Override
		public int getCount() {
			return list.size();
		}

		@Override
		public Object getItem(int position) {
			return list.get(position);
		}

		@Override
		public long getItemId(int position) {
			return position;
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			return list.get(position);
		}

	}

}
